// src/utils/questionTemplate.js
import { v4 as uuidv4 } from 'uuid';

export const createQuestion = (type = 'single') => {
  const base = {
    id: uuidv4(),
    type,
    title: '',
    required: false,
  };

  switch (type) {
    case 'single':
    case 'multiple':
      return { ...base, options: ['', ''] };
    case 'text':
      return base;
    case 'rating':
      return { ...base, min: 1, max: 5 };
    case 'location':
      return base;
    default:
      throw new Error('未知题型');
  }
};